import request from '@/utils/request'

export default {

  /*
  获取权限(菜单/功能)列表
  */
  findNodes() {
    return request({
      url: '/admin/system/permission/findNodes',
      method: 'get'
    })
  },

  /*
  删除
  */
  removeById(id) {
    return request({
      url: '/admin/system/permission/remove/'+id,
      method: 'delete'
    })
  },

  /*
  保存
  */
  save(permission) {
    return request({
      url: '/admin/system/permission/save',
      method: "post",
      data: permission
    })
  },

  /*
  更新
  */
  updateById(permission) {
    return request({
      url: '/admin/system/permission/update',
      method: "post",
      data: permission
    })
  },

  /*
查看某个角色的权限列表
*/
  toAssign(roleId) {
    return request({
      url: '/admin/system/permission/toAssign/'+roleId,
      method: 'get'
    })
  },

  /*
  给某个角色授权
  */
  doAssign(assginMenuVo) {
    return request({
      url: '/admin/system/permission/doAssign/',
      method: "post",
      data: assginMenuVo
    })
  }
}
